package demoMod.stsconsole.cards.red;

import demoMod.stsconsole.cards.AbstractCard;
import demoMod.stsconsole.characters.AbstractPlayer;
import demoMod.stsconsole.core.AbstractCreature;
import demoMod.stsconsole.helpers.DamageInfo;

public class FiendFire extends AbstractCard {
    public static final String ID = "FiendFire";

    public FiendFire() {
        super(ID);
        this.baseDamage = 7;
        this.color = CardColor.RED;
        this.cost = 2;
        this.rarity = CardRarity.RARE;
        this.type = CardType.ATTACK;
        this.target = CardTarget.ENEMY;
        this.exhaust = true;
    }

    @Override
    public void upgrade() {
        if (!this.upgraded) {
            this.baseDamage += 3;
            this.upgraded = true;
            this.name = this.name + "+";
            this.upgradeTimes++;
        }
    }

    @Override
    public boolean use(AbstractPlayer p, AbstractCreature target) {
        if (target != null) {
            for (int i = 0; i < p.hand.size() - 1; i++) {
                target.damage(new DamageInfo(this.damage, p));
            }
        }
        for (int i = 0; i < p.hand.size(); i++) {
            p.exhaustCard(p.hand.get(0), p.hand);
        }
        return true;
    }
}
